<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="zh-CN">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>OSC Open API</title>
    <style type="text/css">
        .left{float: left;width: 200px;background-color: #F3F3F3;}
        .right{float: left;width: 800px;height: 1000px;margin-left: 20px;}
        .title{background-color: #EDF3F9;padding-left: 20px;margin: 10px 0px;font-weight: bold;font-size: 14px;}
        .context{padding-left: 20px;font-size: 12px;}
        .example{border: 1px dashed black;padding-left: 30px;background-color: #f9f9f9;font-size: 12px;overflow: hidden;line-height: 1.1em;}
        .search_text{float: left;width: 150px;}
        .search_btn{float: left}
        .returnType{font-weight: bold;font-size: 12px;padding-left: 30px;}
        .url{font-weight: bold;}
        .clear{clear: both;}
        .return{font-size: 12px;}
    </style>
    <script type="text/javascript" src="./js/jquery.js"></script>
    <script type="text/javascript" src="./js/baidutemplate.js"></script>

    <script type="text/html" id="json">
{
    "id": 49262, 
    "body": "<style type='text/css'>pre {white-space:pre-wrap;word-wrap:break-word;}</style>博客内容Demo", 
    "pubDate": "2013-10-08 16:19:38.0", 
    "author": "张艺辰", 
    "title": "博客标题Demo", 
    "authorid": 253479, 
    "notice": {
        "replyCount": 0, 
        "msgCount": 0, 
        "fansCount": 0, 
        "referCount": 0
    }, 
    "favorite": 0, 
    "commentCount": 0, 
    "url": "http://home.oschina.org/yidongnan/blog/49262"
}
    </script>
    <script type="text/javascript">
        var data = {
            api:'/action/openapi/blog_detail',
            api_desc:'获取博客详情',
            url:'/action/openapi/blog_detail',
            dataType:'JSON JSONP XML',
            reqType:'GET/POST',
            require_login: '否',
            access_auth: '暂无',
            req_param: [
                {name:'id',must: true,type_range:'long',desc:'博客编号',default:'空'},
                {name:'access_token',must: false,type_range:'string',desc:'oauth2_token获取的access_token 传则显示是否收藏 用户未登录则不传',default:''},
                {name:'dataType',must: false,type_range:'string',desc:'返回数据类型 [\'json\'|\'jsonp\'|\'xml\']',default:'json'}
            ],
            tip:'暂无',
            resultType: 'JSON',
            ret_param: [
                {name:'id',type_range:'long',desc:'博客编号'},
                {name:'title',type_range:'string',desc:'博客标题'},
                {name:'body',type_range:'string',desc:'博客内容（HTML）'},
                {name:'pubDate',type_range:'datetime',desc:'发布日期'},
                {name:'authorid',type_range:'long',desc:'投递者编号'},
                {name:'favorite',type_range:'int',desc:'是否收藏 1-收藏 0-未收藏'},
                {name:'commentCount',type_range:'int',desc:'评论数'},
                {name:'url',type_range:'string',desc:'博客地址'},
                {name:'relativies.title',type_range:'string',desc:'新闻标题'},
                {name:'relativies.url',type_range:'string',desc:'新闻原链接'},
                {name:'notice.replyCount',type_range:'int',desc:'未读评论数'},
                {name:'notice.msgCount',type_range:'int',desc:'未读留言数'},
                {name:'notice.fansCount',type_range:'int',desc:'新增粉丝数'},
                {name:'notice.referCount',type_range:'int',desc:'未读@我数'}
            ]
        };
        $(function(){
            data.result =  $("#"+data.resultType.toLowerCase()).html();
            var html = baidu.template("context",data);
            $('body').after(html);
        });
    </script>
    <script type="text/html" id="context">
        <div class="right">
            <div class="url"><%:=api%>  </div>
            <hr>
            <div class="title"><%:=api%></div>
            <div class="context"><%:=api_desc%></div>
            <div class="title">URL</div>
            <div class="context"><%:=url%></div>
            <div class="title">支持格式</div>
            <div class="context"><%:=dataType%></div>
            <div class="title">HTTP请求方式</div>
            <div class="context"><%:=reqType%></div>
            <div class="title">是否需要登录</div>
            <div class="context"><%:=require_login%></div>
            <div class="title">访问授权限制</div>
            <div class="context"><%:=access_auth%></div>
            <div class="title">请求参数</div>
            <%if(req_param.length>0) { %>
            <div class="return">
                <table  border="1" cellspacing="0" bordercolor="#000000" style="border-collapse:collapse;">
                    <tr>
                        <th width="91px"></th>
                        <th width="33px">必选</th>
                        <th width="67px">类型及范围</th>
                        <th width="531px">说明</th>
                        <th width="66px">默认值</th>
                    </tr>
                    <%for(var i=0;i<req_param.length;i++){%>
                    <tr>
                        <td><%=req_param[i].name%></td>
                        <td><%=req_param[i].must%></td>
                        <td><%=req_param[i].type_range%></td>
                        <td><%=req_param[i].desc%></td>
                        <td><%=req_param[i].default%></td>
                    </tr>
                    <%}%>

                </table>
            </div>
            <%}else{%>
            <div class="context">无</div>
            <%}%>

            <div class="title">注意事项</div>
            <div class="context"><%:=tip%>；</div>

            <div class="title">返回结果</div>
            <div class="return">
                <div class="returnType"><%=resultType%></div>
                <div class="example">
                    <pre><%:=result%>
                    </pre>
                </div>
                <div class="title">返回字段说明</div>
                <div class="return">
                    <table  border="1" cellspacing="0" bordercolor="#000000" style="border-collapse:collapse;">
                        <tr>
                            <th width="91px">返回值字段</th>
                            <th width="100px">类型及范围</th>
                            <th width="600px">说明</th>
                        </tr>
                        <%for(var i=0;i<ret_param.length;i++){%>
                        <tr>
                            <td><%=ret_param[i].name%></td>
                            <td><%=ret_param[i].type_range%></td>
                            <td><%=ret_param[i].desc%></td>
                        </tr>
                        <%}%>
                    </table>
                </div>
            </div>
        </div>
    </script>
</head>
<body>
</body>
</html>